package collection01;

import java.util.ArrayList;
import java.util.Collection;

/*
* 集合中移除功能：
* boolean remove(Object o)
*          从此 collection 中移除指定元素的单个实例，如果移除成功返回true,
*           否则返回false
* */
public class CollectionDemo04 {
    public static void main(String[] args) {
        Collection c = new ArrayList();
        Person p1 = new Person("乔峰",30);
        Person p2 = new Person("阿朱",20);

        c.add(p1);
        c.add(p2);

        Person p3 = new Person("乔峰",30);
        System.out.println(c.remove(p3));
        System.out.println(c);
        //true
        // [Person{name='阿朱', age=20}]
    }
}
